<?php
/*
 * Release Prep System
 */
 define('VERSION', 'Technology Preview 1');
echo "Preparing....";
set_time_limit(0);
ini_set("memory_limit", "64M");
echo "<br />Starting...<br /><hr /><br />";
// Functions
function process($f) {
	if(is_dir($f)) {
		/*if ($h[$f] = opendir($f)) {
			while (false !== ($file = readdir($h[$f]))) {
				if (substr($file, 0, 1) !== ".") {
					process($f."/".$file);
				}
			}
			closedir($h[$f]);
		}*/
	}
	else {
		$content = file_get_contents($f);
		$content = str_replace("<#RELEASE_VERSION#>", VERSION, $content);
		file_put_contents($f, $content);
		echo "Processed {$f}, continue...<br>";
	}
}
//
if ($handle = opendir('.')) {
	while (false !== ($file = readdir($handle))) {
		if (substr($file, 0, 1) !== "." and $file !== "prepare_release.php" and $file !== "dumpfile.php") {
			process("./".$file);
		}
	}
	closedir($handle);
}
// End
